Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-focus-on
Advanced tools
The final solution for WAI ARIA compatible modal dialogs or full-screen tasks.
The final solution for WAI ARIA compatible Modal Dialogs or any full-screen tasks:
Now you could focus on a single task.
This is basically the
inert
Minimal size - no more than 2kb, maximal - no more that 6kb. See sidecar example for details.
Code sandbox example - https://codesandbox.io/s/p3vjp8mzw7
import {FocusOn} from 'react-focus-on';
<FocusOn
onClickOutside={callback}
onEscapeKey={callback}
shards={[externalRef]}
>
content you should be "focused" on
</FocusOn>
FocusOn
- the focus on component
enabled
- controls behaviour[shards]
- a list of Refs to be considered as a part of the Lock. A way to properly handle portals or scattered lock.[autoFocus=true]
- enables or disables auto focus
management (see react-focus-lock documentation)[returnFocus=true]
- enables or disables return focus
on lock deactivation (see react-focus-lock documentation)[whiteList=fn]
- you could whitelist locations FocusLock should carry about. Everything outside it will ignore. For example - any modals (see react-focus-lock documentation)[crossFrame=true]
- enables or disables cross frame focus trapping. Setting this to false allows focus to move outside iframes (see react-focus-lock issue)[gapMode]
- the way removed ScrollBar would be compensated - margin(default), or padding. See scroll-locky documentation to find the one you need.[noIsolation]
- disables aria-hidden isolation[inert]
- enables pointer-events isolation (☠️ dangerous, use to disable "parent scrollbars", refer to react-remove-scroll documentation)[allowPinchZoom]
- enables "pinch-n-zoom" behavior. By default it might be prevented, refer to react-remove-scroll documentation[preventScrollOnFocus]
- prevents a side effect of a programatic page scroll caused by focusing elements. Especially useful to address modal animations.[onActivation]
- on activation callback[onDeactivation]
- on deactivation callback[onClickOutside]
- on click outside of "focus" area. (actually on any event "outside")[onEscapeKey]
- on Esc key down (and not defaultPrevented)AutoFocusInside
- to mark autofocusable elementMoveFocusInside
- to move focus inside a component on mountInFocusGuard
- to "guard" a shard node (place an invisible node before and after)See react-focus-lock documentation for details.
classNames.fullWidth
- "100%" width (will not change on scrollbar removal)classNames.zeroRight
- "0" right (will not change on scrollbar removal)See react-remove-scroll for details.
PS: Version 1 used React-scroll-locky which was replaced by remove-scroll.
import {FocusOn} from 'react-focus-on';
<FocusOn>
{content}
</FocusOn>
import {FocusOn} from 'react-focus-on/UI';
import {sidecar} from "use-sidecar";
const FocusOnSidecar = sidecar(
() => import(/* webpackPrefetch: true */ "react-focus-on/sidecar")
);
<FocusOn
sideCar={FocusOnSidecar}
>
{content}
</FocusOn>
MIT
FAQs
The final solution for WAI ARIA compatible modal dialogs or full-screen tasks.
The npm package react-focus-on receives a total of 150,657 weekly downloads. As such, react-focus-on popularity was classified as popular.
We found that react-focus-on demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.